version: '3.1'
services:
  backend-service:
    build:
      context: ./backend
      dockerfile: Dockerfile

    ports:
      - "5000:5000"
    depends_on:
      - main-db
    environment:
      - server.port=5000
      - spring.datasource.url=jdbc:postgresql://main-db:5432/hr_simulator
      - spring.datasource.username=postgres
      - spring.datasource.password=root
      - spring.jpa.show-sql=true
      - spring.jpa.hibernate.ddl-auto=update

  main-db:
    image: postgres:14-alpine
    container_name: main-db-container
    ports:
      - "5432:5432"
    environment:
      - POSTGRES_DB=hr_simulator
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=root

  frontend-service:
    build:
      context: ./frontend
      dockerfile: Dockerfile

    ports:
      - "8081:8081"
